home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 13867 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.1 KB  |  29 lines

  1. Newsgroups: comp.lang.c
  2. Path: netcom.com!smryan
  3. From: smryan@netcom.com (@#$%!?!)
  4. Subject: Re: Formatted print with variable output field width.
  5. Message-ID: <smryanDpMqv2.Bv4@netcom.com>
  6. Organization: The Programmer formerly known as S M Ryan
  7. X-Newsreader: TIN [version 1.2 PL1]
  8. References: <berlinerDpMBoE.AEn@netcom.com>
  9. Date: Wed, 10 Apr 1996 04:52:13 GMT
  10. Sender: smryan@netcom12.netcom.com
  11.  
  12. :       printf("%<v+3>.<v>f", floatingnum);
  13.  
  14.  
  15.     char s[100];
  16.     sprintf(s,"%%%d.%df",v+3,v);
  17.     printf(s,floatingnum);
  18.  
  19. Any C function that has a char* argument, such as the first of printf,
  20. you can use a constant string, a character array, a character pointer,
  21. a function which returns a character pointer (such as printf(fgets(f),g)),
  22. or any other expression which is char*. 
  23.  
  24. -- 
  25. The Queen, amused, in quiet power,         | smryan@netcom.com  PO Box 1563
  26. will draw the son to darkenned bower.      |          Cupertino, California
  27. Her face is fair, her fragrance rare,      | (xxx)xxx-xxxx            95015
  28. with woven webs for wayward flower.        |         I don't use no smileys
  29.